home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
pstui100.zip
/
DEMO2.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-02-16
|
11KB
|
312 lines
{
╔══════════════════╗
║ PTUI Demo ║
║ ║
║ Rev. 1.00 ║
╚══════════════════╝
}
Program Demo;
{$F-} {$O-} {$A+} {$G-}
{$V-} {$B-} {$X-} {$N+} {$E+}
{$I FINAL.PAS}
{$IFDEF FINAL}
{$I-} {$R-}
{$D-} {$L-} {$S-}
{$M 8192,262144,655360}
{$ELSE}
{$M 8192,0,655360}
{$ENDIF}
Uses CRT,Strings,PTUI,PTUIVCRT,KeyDef;
Var
Win :Array [1..2] of TextWindow;
NewSlide :SlideBarInfo;
ActiveWin :Byte;
St :String;
MX,MY :Word;
MB :Byte;
Held,
Doubled,
Special :Boolean;
Key :Char;
Param :String;
Begin
If ParamCount>0 Then
UpperCase(ParamStr(1),Param)
Else
Param:='';
If Pos('?',Param)>0 Then
Begin
WriteLn('This demo is used on computers with both a EGA/VGA card and');
WriteLn('a mono card. Use /E if you have an EGA, otherwise VGA is assumed.');
Halt;
End;
If (Card=ColorCard) Then
Begin
If Pos('/E',Param)>0 Then
EnableVScreen(EGA)
Else
EnableVScreen(VGA);
SetVirtualScreen(160,70);
End;
GotoCard(ColorCard);
ClrScr;
PushCursorSize;
CursorSize($20,$20);
Cursor:=False;
Mouse.Init(True);
InstallVScreenMouse;
TextBackground(Blue);
TextColor(Yellow);
FillBlock(1,1,160,70,' ');
GotoXY(2,2);
WriteStr(#7+' Click here to exit or press [Esc] to exit.');
GotoXY(4,3);
WriteStr('Swap between windows with Right Mouse Button or [Tab].');
GotoXY(4,4);
WriteStr('Mouse users can drag the window by holding on to the heading and moving the mouse.');
GotoXY(4,5);
WriteStr('Keyboard users (no mouse) can use [F5] and the cursor keys, followed by [Return].');
GotoXY(4,6);
WriteStr('Use the mouse or [Ctrl][PgUp] [PgDn] [Left] [Right] to scroll across the VGA virtual screen.');
GotoCard(MonoCard);
FillBlock(1,1,80,25,'▒');
Win[1].Card:=ColorCard;
GotoCard(Win[1].Card);
Win[1].Open(10,10,50,20,Yellow,Green,Blue,Magenta,NoLine,Solid);
Win[1].NewHeading('Window 1',CentreText,Yellow,Red);
Win[1].HeadingIcon(True);
NewSlide.X1:=48;
NewSlide.Y1:=13;
NewSlide.X2:=48;
NewSlide.Y2:=19;
NewSlide.Forg:=Yellow;
NewSlide.Back:=Green;
NewSlide.MainChar:='░';
NewSlide.ButtonChar:='▓';
NewSlide.UpLeftChar:=#$18;
NewSlide.DownRightChar:=#$19;
NewSlide.CurPos:=0;
NewSlide.MaxPos:=99;
Win[1].VertSlideBar(NewSlide);
NewSlide.X1:=12;
NewSlide.Y1:=19;
NewSlide.X2:=47;
NewSlide.Y2:=19;
NewSlide.UpLeftChar:=#$1B;
NewSlide.DownRightChar:=#$1A;
Win[1].HorzSlideBar(NewSlide);
Win[1].VertSlideIcon(True);
Win[1].HorzSlideIcon(True);
Win[1].Buttons.Add(2,2,2,2,False,#27);
Win[1].Buttons.Add(0,0,0,0,False,#9);
Win[1].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_Right),KeyCode(Key_Ctrl,Key_Right));
Win[1].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_Left) ,KeyCode(Key_Ctrl,Key_Left));
Win[1].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_PgUp) ,KeyCode(Key_Ctrl,Key_PgUp));
Win[1].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_PgDn) ,KeyCode(Key_Ctrl,Key_PgDn));
Win[2].Card:=MonoCard;
GotoCard(Win[2].Card);
Win[2].Open(15,15,60,23,White,Black,LightGrey,Black,DoubleLine,LightHash);
Win[2].NewHeading('Window 2',CentreText,Black,LightGrey);
Win[2].HeadingIcon(True);
Win[2].Buttons.Add(2,2,2,2,False,#27);
Win[2].Buttons.Add(0,0,0,0,False,#9);
Win[2].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_Right),KeyCode(Key_Ctrl,Key_Right));
Win[2].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_Left) ,KeyCode(Key_Ctrl,Key_Left));
Win[2].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_PgUp) ,KeyCode(Key_Ctrl,Key_PgUp));
Win[2].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_PgDn) ,KeyCode(Key_Ctrl,Key_PgDn));
Mouse.Show;
ActiveWin:=2;
GotoCard(Win[ActiveWin].Card);
Repeat
Win[ActiveWin].Buttons.WaitForClick(MX,MY,MB,Held,Doubled,Special,Key);
If (MB=MouseRightButton) Or ((Key=#9) And (Not Special)) Then
Begin
If ActiveWin=1 Then
ActiveWin:=2
Else
ActiveWin:=1;
GotoCard(Win[ActiveWin].Card);
End;
If (Special=SpecialCode(Key_Ctrl,Key_Right)) And
(Key=KeyCode(Key_Ctrl,Key_Right)) And
(VideoCard[Card].SX2<VideoCard[Card].XSize) Then
Begin
If Not KeyPressed Then
Begin
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + 1,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + 4,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + 6,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + 7,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
End;
ScreenOrigin((VideoCard[Card].SX1) * VideoCard[Card].CharacterLength,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
End;
If (Special=SpecialCode(Key_Ctrl,Key_Left)) And
(Key=KeyCode(Key_Ctrl,Key_Left)) And
(VideoCard[Card].SX1>1) Then
Begin
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength - 1,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
If Not KeyPressed Then
Begin
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + 6,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + 4,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + 1,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
End;
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
End;
If (Special=SpecialCode(Key_Ctrl,Key_PgDn)) And
(Key=KeyCode(Key_Ctrl,Key_PgDn)) And
(VideoCard[Card].SY2<VideoCard[Card].YSize) Then
Begin
If Not KeyPressed Then
Begin
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight + 2);
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight + 7);
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight + 11);
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight + 14);
End;
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
(VideoCard[Card].SY1) * VideoCard[Card].CharacterHeight);
End;
If (Special=SpecialCode(Key_Ctrl,Key_PgUp)) And
(Key=KeyCode(Key_Ctrl,Key_PgUp)) And
(VideoCard[Card].SY1>1) Then
Begin
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
(VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight - 2);
If Not KeyPressed Then
Begin
ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
(VideoCard[Card].SY1 - 1) * VideoCard